﻿using Abp.NHibernate.EntityMappings;
using Akso.Authorization.Users;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Akso.NHibernate.EntityMappings
{
    /// <summary>
    /// Define mapping between <see cref="User"/> entity and "AbpUsers" table using FluentNHibernate.
    /// 
    /// Inherits from <see cref="EntityMap{TEntity,TPrimaryKey}"/>.
    /// EntityMap gets table name in it's constructor and automatically maps Id property. So, we do not map Id again.
    /// </summary>
    public class UserMap : EntityMap<User, long>
    {
        public UserMap() : base("AbpUsers")
        {
            LazyLoad();
            Id(x => x.Id);
            Map(x => x.AuthenticationSource);
            Map(x => x.CreationTime);
            Map(x => x.CreatorUser);
            Map(x => x.CreatorUserId);
            Map(x => x.DeleterUser);
            Map(x => x.DeleterUserId);
            Map(x => x.DeletionTime);
            Map(x => x.EmailAddress);
            Map(x => x.EmailConfirmationCode);
            Map(x => x.FullName);
            Map(x => x.IsActive);
            Map(x => x.IsDeleted);
            Map(x => x.IsEmailConfirmed);
            Map(x => x.LastLoginTime);
            Map(x => x.LastModificationTime);
            Map(x => x.LastModifierUser);
            Map(x => x.LastModifierUserId);
            Map(x => x.Logins);
            Map(x => x.Name);
            Map(x => x.Password);
            Map(x => x.PasswordResetCode);
            Map(x => x.Permissions);
            Map(x => x.ProfilePictureId);
            Map(x => x.Roles).LazyLoad();
            Map(x => x.Settings);
            Map(x => x.ShouldChangePasswordOnNextLogin);
            Map(x => x.Surname);
            Map(x => x.TenantId).LazyLoad();
            Map(x => x.UserName);
            //References(x => x.AssignedPerson).Column("AssignedPersonId").LazyLoad();
        }
    }
}
